<template>
  <el-drawer title="详情" :visible.sync="visible" :wrapperClosable="false"
             size="600px" append-to-body class="JNPF-common-drawer">
    <div class="JNPF-flex-main">
      <div class="dynamicForm dynamicDetail">
        <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="top">
          <template v-if="!loading">
            <el-col :span="12">
              <el-form-item label="资产信息"
                            prop="assetId">
                <p>{{ dataForm.assetId }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="评估基准日"
                            prop="appraisalBaseDate">
                <p>{{ jnpf.toDate(dataForm.appraisalBaseDate, "yyyy-MM-dd") }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="评估报告日"
                            prop="appraisalReportDate">
                <p>{{ jnpf.toDate(dataForm.appraisalReportDate, "yyyy-MM-dd") }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="评估机构"
                            prop="evaluationAgency">
                <p>{{ dataForm.evaluationAgency | dynamicText(evaluationAgencyOptions) }} </p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="评估公允总价值"
                            prop="fairTotalPrice">
                <p>{{ dataForm.fairTotalPrice }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="评估公允单价"
                            prop="fairUnitPrice">
                <p>{{ dataForm.fairUnitPrice }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="评估公允市场租金"
                            prop="fairMarketRent">
                <p>{{ dataForm.fairMarketRent }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="备注"
                            prop="remark">
                <p>{{ dataForm.remark }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="附件"
                            prop="attachmentUrls">
                <JNPF-UploadFz v-model="dataForm.attachmentUrls"
                               disabled
                               detailed :fileSize="10" sizeUnit="MB" :limit="9" buttonText="点击上传">
                </JNPF-UploadFz>
              </el-form-item>
            </el-col>
          </template>
        </el-form>
      </div>
      <div class="drawer-footer">
        <el-button @click="visible = false"> 取 消</el-button>
      </div>
    </div>
  </el-drawer>
</template>
<script>
import request from '@/utils/request'
import PrintBrowse from '@/components/PrintBrowse'
import jnpf from '@/utils/jnpf'

export default {
  components: {PrintBrowse},
  props: [],
  data() {
    return {
      visible: false,
      loading: false,
      printBrowseVisible: false,
      printId: '',
      dataForm: {
        id: '',
        assetId: "",
        appraisalBaseDate: '',
        appraisalReportDate: '',
        evaluationAgency: "",
        fairTotalPrice: '',
        fairUnitPrice: '',
        fairMarketRent: '',
        remark: '',
        attachmentUrls: [],
      },
      evaluationAgencyOptions: [],

    }
  },
  computed: {},
  watch: {},
  created() {

  },
  mounted() {
  },
  methods: {
    dataInfo(dataAll) {
      let _dataAll = dataAll
      _dataAll.evaluationAgency = _dataAll.evaluationAgency ? JSON.parse(_dataAll.evaluationAgency) : []
      _dataAll.attachmentUrls = _dataAll.attachmentUrls ? JSON.parse(_dataAll.attachmentUrls) : []
      this.dataForm = _dataAll
    },

    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true
          request({
            url: '/api/zc/ZcAssetEvaluate/detail/' + this.dataForm.id,
            method: 'get'
          }).then(res => {
            this.dataInfo(res.data)
            this.loading = false
          })
        }

      })
    },
  },
}

</script>
